package com.guapi.dao;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.*;
import com.guapi.util.BaseConstant;
import lombok.Data;

import java.io.Serializable;

/**
 * @author 瓜皮哦
 */
@Data

public class BaseDao implements Serializable, BaseConstant {
    @TableId(type = IdType.AUTO)
    protected Integer id;

    @TableField("create_by")
    protected String createBy;

    //0系统注册，若为其他人，则为account
    @TableField("create_date")
    @OrderBy(asc = true)
    protected String createDate;


    @TableField("update_by")
    protected String updateBy;

    @TableField("last_update")
    protected String lastUpdate;

    //0可用，1被关停
    protected String enable;
    //0可用，1被锁定
    protected String lockable;
    //0未被删除，1被删除
    @TableLogic(value = "0", delval = "id")
    protected Integer deletable;

    protected String field_attribute1;
    protected String field_attribute2;
    protected String field_attribute3;
    protected String field_attribute4;
    protected String field_attribute5;
    protected String field_attribute6;
    protected String field_attribute7;
    protected String field_attribute8;
    protected String field_attribute9;
    protected String field_attribute10;

    public boolean judgeIsDeletable() {
        return ObjectUtil.equals(this.deletable, ISDELETABLE);
    }

    public boolean judgeIsEnable() {
        return ObjectUtil.equals(this.enable, ISENABLE);
    }

    public boolean judgeIsLocked(){
        return ObjectUtil.equal(this.lockable,ISLOCK);
    }
}
